@echo off
title name
set "var=test"
echo %var%

pushd "myImages"
for /f "tokens=4" %%i in ('dir') do (
    echo %%i | findstr /C:"upup" > nul
    if not errorlevel 1 (
        set "var=%%i"
    )
)
popd
echo %var%
